<?php
/**
 * Created by PhpStorm.
 * User: sjj.
 * Date: 2019/2/21
 * Time: 11:22
 */
namespace app\index\controller;
use app\common\controller\Frontend;
use app\index\model\Btc as BtcModel;

class Btc extends Frontend{
    protected $layout = 'default';
    protected $noNeedLogin = ['index'];
    public function index(){
        $exchange = ['huobi','okex'];
        $LittleType = ['BTC','ETH','EOS'];
        $BtcModel = new BtcModel();
        foreach ($exchange as $item) {
            foreach ($LittleType as $value) {
                $url  = "https://m.bte.top/app/api/future/burned?exchange=".$item."&base=".$value."&quote=QUARTER";
                $content = file_get_contents($url);
                $infoList = json_decode($content,true);
                foreach ($infoList['data'] as $v) {
                    $v['exchange'] = $item;
                    $v['base']     = $value;
                    $BtcModel->insert($v);
                }
            }
        }

        die;
    }
}